package com;

public class Demo {

	public static void main(String[] args) throws InterruptedException {
		for (int i = 0; i < 100; i++) {
			Thread.sleep(1000);
			System.out.println(getDemo().getName());
		}
	}

	private String name = "aaa";

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	private static Demo d;

	public static Demo getDemo() {
		if (d == null) {
			d = new Demo();
		}
		return d;
	}
}
